Skip to content

db export: Avoid exec() in option probe#326

Merged
swissspidy merged 2 commits intomainfrom
no-exec
Apr 21, 2026
Merged

db export: Avoid exec() in option probe#326
swissspidy merged 2 commits intomainfrom
no-exec

Conversation

@scribu
Copy link
Copy Markdown
Member

@scribu scribu commented Apr 21, 2026

As described in #283, if the host disables the exec() function, db export will fail silently with exit code 255.

This works around that that by using Utils\proc_open_compat().

@scribu scribu requested a review from a team as a code owner April 21, 2026 15:19
@github-actions
Copy link
Copy Markdown
Contributor

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Here are some useful Composer commands to get you started:

  • composer install: Install dependencies.
  • composer test: Run the full test suite.
  • composer phpcs: Check for code style violations.
  • composer phpcbf: Automatically fix code style violations.
  • composer phpunit: Run unit tests.
  • composer behat: Run behavior-driven tests.

To run a single Behat test, you can use the following command:

# Run all tests in a single file
composer behat features/some-feature.feature

# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123

You can find a list of all available Behat steps in our handbook.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a test case for database exports when PHP's exec() function is disabled and replaces direct exec() calls with a new command_supports_option method. Feedback suggests refactoring this new method to use WP_CLI\Process to mitigate potential deadlock risks and remove unnecessary STDIN usage.

Comment thread src/DB_Command.php Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.1.6 milestone Apr 21, 2026
Copy link
Copy Markdown
Member

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a lovely surprise to see you here! Thanks for your contribution :)

@swissspidy swissspidy merged commit 8a1bd2c into main Apr 21, 2026
56 of 62 checks passed
@swissspidy swissspidy deleted the no-exec branch April 21, 2026 15:56
@scribu
Copy link
Copy Markdown
Member Author

scribu commented Apr 21, 2026

Heya :) No problem, thanks for the quick merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants